package com.luck.picture.lib.tools;

import android.net.Uri;

import com.luck.picture.lib.entity.LocalMedia;

public class LocalMediaUtils {

    public static String getLocalPath(LocalMedia media){
        String path;
        if (media.isCut() && !media.isCompressed()) {
            // 裁剪过
            path = media.getCutPath();
        } else if (media.isCompressed() || (media.isCut() && media.isCompressed())) {
            // 压缩过,或者裁剪同时压缩过,以最终压缩过图片为准
            path = media.getCompressPath();
        } else {
            // 原图
            path = media.getPath();
        }
        path = path.startsWith("content://") && !media.isCut() && !media.isCompressed() ? Uri.parse(path).getPath() : path;
        return path;
    }


}
